/*
################################
# PROJECT NIRVANA              #
# COPYRIGHT (c) 2009 - HAMMAD. #
################################

   This file is part of Project Nirvana.

    Project Nirvana is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Project Nirvana is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with Project Nirvana.  If not, see <http://www.gnu.org/licenses/>.
*/

#include "Logging.h"
#include <windows.h>
using namespace std;

#pragma region FUNCTION_DEFINITIONS
void Log::WriteInformation(string sLog)
{
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),3); // Set text to colour "Dark Cyan"
	std::cout << sLog << endl << flush; // Print output with a line break, then flush the buffer
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),7); // Set colour back to default "Light Gray"
}

void Log::WriteLine(string sLog)
{
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),7); // Set text to colour "Dark Gray"
	std::cout << sLog << endl << flush; // Print output with a line break, then flush the buffer
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),7); // Set colour back to default "Light Gray"
}

void Log::WriteWarning(string sLog)
{
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),14); // Set text to colour "Yellow"
	std::cout << sLog << endl << flush; // Print output with a line break, then flush the buffer
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),7); // Set colour back to default "Light Gray"
}


void Log::WriteError(string sLog)
{
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),4);
	std::cout << sLog << endl << flush;
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),7); // Set colour back to default "Light Gray"
}

/*void WriteUnhandledExceptionError(string sMethod, exception& ex)
{
	System::Console::WriteLine("Unhandled exception in " + sMethod + "() method, " + "exception message: " + ex.what);
}*/
#pragma endregion FUNCTION_DEFINITIONS